{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Notebook for preparing and saving MNIST graphs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import torch\n",
    "import pickle\n",
    "import time\n",
    "import os\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Download MNIST dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "downloading..\n",
      "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n",
      "                                 Dload  Upload   Total   Spent    Left  Speed\n",
      "  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\n",
      "  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\n",
      "100  324M  100  324M    0     0  3787k      0  0:01:27  0:01:27 --:--:-- 3527k74k      0  0:01:38  0:00:34  0:01:04 4112k1 3698k\n",
      "x superpixels/cifar10_150sp_test.pkl\n",
      "x superpixels/cifar10_150sp_train.pkl\n",
      "x superpixels/mnist_75sp_test.pkl\n",
      "x superpixels/mnist_75sp_train.pkl\n"
     ]
    }
   ],
   "source": [
    "if not os.path.isfile('superpixels.zip'):\n",
    "    print('downloading..')\n",
    "    !curl https://www.dropbox.com/s/y2qwa77a0fxem47/superpixels.zip?dl=1 -o superpixels.zip -J -L -k\n",
    "    !tar -xvf superpixels.zip -C ../\n",
    "else:\n",
    "    print('File already downloaded')\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Convert to DGL format and save with pickle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Users/xbresson/Documents/Dropbox/06_NTU_2017_now/03_my_codes/34_benchmark20/GITHUB_benchmark_project/benchmarking-gnn\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "os.chdir('../../') # go to root folder of the project\n",
    "print(os.getcwd())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pickle\n",
    "\n",
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "from data.superpixels import SuperPixDatasetDGL \n",
    "\n",
    "from data.data import LoadData\n",
    "from torch.utils.data import DataLoader\n",
    "from data.superpixels import SuperPixDataset\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Adj matrix defined from super-pixel locations (only)\n",
      "preparing 10000 graphs for the TEST set...\n",
      "preparing 60000 graphs for the TRAIN set...\n",
      "[I] Data load time: 361.0098s\n",
      "Time (sec): 361.0104629993439\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "\n",
    "DATASET_NAME = 'MNIST'\n",
    "dataset = SuperPixDatasetDGL(DATASET_NAME) \n",
    "\n",
    "print('Time (sec):',time.time() - start) # 356s=6min\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEICAYAAABfz4NwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAWaElEQVR4nO3df7DddZ3f8edroWZECSJcLJvgBjQ6BWY3SoZlx9HSsl0iWoOt7IZ2hd3SBhiYrqM7u7BtR2anacGupWW6xuXXElwFEddCC3RlpSPtFMELpvxSaoBoLskmV0HEVVMT3/3jfG49uTn3Jjnn/jg3eT5mzpz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AKWbwrg0zbPCAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "nb/min/max : 55000 40 75\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEICAYAAACzliQjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAUC0lEQVR4nO3df6xc9Znf8fcnZkOTbCzI+oKITdYQOUiAWifcsqzSUBp2w49EAapma1bd0DSSSQRqUVo1JvtHUCVLZBuaBnVD5BA20C5QJxRhLUmBTdvQVrDkQlx+hsYGJ1zstW+WZkOa1Cubp3/MuZvhMtc/Zsb3XvN9v6TRnHnOOXOe+cr6+NzvnJlJVSFJasMbFrsBSdLCMfQlqSGGviQ1xNCXpIYY+pLUEENfkhpi6EuHKMl5SaYXuw9pFIa+tICSrE5SSY5Z7F7UJkNfkhpi6Ks5STYk+cac2heT3JjkY0meSfJykueSXHmA5/l0khe7bZ9Ncn5Xf0N3jO1J/iLJ5iRv63Z7sLv/SZKfJfnNI/MqpcEMfbXoDuDiJMsBkiwDfge4HdgDfAhYDnwM+EKS98x9giSnAVcDf7uq3gpcAOzoVv9T4FLg7wJvB/4P8IfdunO7++Oq6ler6qGxvzrpAAx9Naeqfgg8Ri+YAd4P/LyqHq6qe6tqe/V8B7gfeN+Ap9kPHAucnuRXqmpHVW3v1l0J/H5VTVfVXuA64B84j6+lwNBXq24HLu+Wf7d7TJKLkjyc5KUkPwEuBlbM3bmqtgHX0Av0PUnuTPL2bvWvA3cn+Un3HM/Q+0/ixCP5gqRDYeirVV8HzkuyCrgMuD3JscBdwOeBE6vqOOCbQAY9QV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H/XlU3d1esvRn4DEt/vAf1fQ1LfLz7dV/78iK9D4BexRIf81lz+v4YYx5zz/SHlGQV8EHg5sXuZQwuAW7tlm8FLl3EXl43kiwHzgW+ClBVf1VVP2GJj/cB+j7anA9sr6ofssTHfI7+vsfO0B/evwX+JfDKnPrVSR5PcstS+xOyU8D9SR7tvu4C4MSq2gXQ3Z+waN3Nb1DfsLTH+1RgBvijbhrw5iRvYemP93x9w9Ie77nWAXd0y0t9zPv19w1jHnNDfwhJPgTsqapH56y6CXgnsBbYBdyw0L0dgvdW1XuAi4Crkpy72A0dokF9L/XxPgZ4D3BTVb0b+L/AhsVt6ZDM1/dSH++/1k1JfRj4+mL3cjgG9D32MTf0h/Ne4MPdPPOdwPuT/Ieq2l1V+6vqFeAr9L5VdEmpqp3d/R7gbno97k5yEkB3v2fxOhxsUN9HwXhPA9NV9Wfd42/QC9OlPt4D+z4KxrvfRcBjVbW7e7zUx3zWq/o+EmNu6A+hqq6tqlVVtZren2L/par+0ew/qs5lwJOL0uA8krwlyVtnl4EP0OtxC3BFt9kVwD2L0+Fg8/W91Me7qv4ceCHJaV3pfOBplvh4z9f3Uh/vOS7n1VMkS3rM+7yq7yMx5l69M6Ik5wH/ort659/T+zOsgB3AlbPziEtBklPpnSVD70/426tqY5JfAzYD7wB+BHykql5apDZf4wB9L+nxBkiylt6b/W8EnqN3NcYbWMLjDfP2fSNLfLwBkryZ3le4n1pVf9nVlvS/cZi377H/Gzf0JakhTu9IUkMMfUlqiKEvSQ0x9CWpIYa+JDXE0Jekhhj6ktSQ/w/pGV6Bct+OwAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "nb/min/max : 5000 42 75\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEICAYAAACzliQjAAAABHN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fVwao6UlVvALcy+FbRZaWq9rflIeBrDHo8mGQVQFseWroORxvV93Ew3vuAfVX1ULv/mwzCdLmP98i+j4PxHvbTwCNVdbDdX+5jftT39L0QY27oz0JVXVdVa6pqHYNfxf6gqj569Ieq+QjwxJI0OIkkJyd519F14KcY9LgLuLptdjVw19J0ONpkfS/38a6qPweeT/K+VrqYwdeIL+vxnqzv5T7eE1zJ906RLOsxH/I9fS/EmHv1zhwluQj4hXb1zpcZ/BpWwF7gk0fnEZeDJO9hcJYMg1/hv1JV25P8NWAncCbwHHBFVb24RG2+yRR9L+vxBkiygcGb/e8Avs3gaoy3sYzHGybt+0aW+XgDJHkng69wf09V/a9WW9Y/4zBp3/P+M27oS1JHnN6RpI4Y+pLUEUNfkjpi6EtSRwx9SeqIoS9JHTH0Jakj/xcMh3OMpsJ7CgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "nb/min/max : 10000 42 75\n"
     ]
    }
   ],
   "source": [
    "def plot_histo_graphs(dataset, title):\n",
    "    # histogram of graph sizes\n",
    "    graph_sizes = []\n",
    "    for graph in dataset:\n",
    "        graph_sizes.append(graph[0].number_of_nodes())\n",
    "        #graph_sizes.append(graph[0].number_of_edges())\n",
    "    plt.figure(1)\n",
    "    plt.hist(graph_sizes, bins=20)\n",
    "    plt.title(title)\n",
    "    plt.show()\n",
    "    graph_sizes = torch.Tensor(graph_sizes)\n",
    "    print('nb/min/max :',len(graph_sizes),graph_sizes.min().long().item(),graph_sizes.max().long().item())\n",
    "    \n",
    "plot_histo_graphs(dataset.train,'trainset')\n",
    "plot_histo_graphs(dataset.val,'valset')\n",
    "plot_histo_graphs(dataset.test,'testset')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "55000\n",
      "5000\n",
      "10000\n",
      "(DGLGraph(num_nodes=69, num_edges=552,\n",
      "         ndata_schemes={'feat': Scheme(shape=(3,), dtype=torch.float16)}\n",
      "         edata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float16)}), tensor(7))\n",
      "(DGLGraph(num_nodes=71, num_edges=568,\n",
      "         ndata_schemes={'feat': Scheme(shape=(3,), dtype=torch.float16)}\n",
      "         edata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float16)}), tensor(5))\n",
      "(DGLGraph(num_nodes=74, num_edges=592,\n",
      "         ndata_schemes={'feat': Scheme(shape=(3,), dtype=torch.float16)}\n",
      "         edata_schemes={'feat': Scheme(shape=(1,), dtype=torch.float16)}), tensor(7))\n"
     ]
    }
   ],
   "source": [
    "print(len(dataset.train))\n",
    "print(len(dataset.val))\n",
    "print(len(dataset.test))\n",
    "\n",
    "print(dataset.train[0])\n",
    "print(dataset.val[0])\n",
    "print(dataset.test[0])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time (sec): 36.544209003448486\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "\n",
    "with open('data/superpixels/MNIST.pkl','wb') as f:\n",
    "        pickle.dump([dataset.train,dataset.val,dataset.test],f)\n",
    "        \n",
    "print('Time (sec):',time.time() - start) # 38s\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Test load function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[I] Loading dataset MNIST...\n",
      "train, test, val sizes : 55000 5000 10000\n",
      "[I] Finished loading.\n",
      "[I] Data load time: 43.6288s\n"
     ]
    }
   ],
   "source": [
    "DATASET_NAME = 'MNIST'\n",
    "dataset = LoadData(DATASET_NAME) # 54s\n",
    "trainset, valset, testset = dataset.train, dataset.val, dataset.test\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time (sec): 0.00020384788513183594\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "\n",
    "batch_size = 10\n",
    "collate = SuperPixDataset.collate\n",
    "train_loader = DataLoader(trainset, batch_size=batch_size, shuffle=True, collate_fn=collate)\n",
    "\n",
    "print('Time (sec):',time.time() - start) # 0.0003s\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
